CMAKE_MINIMUM_REQUIRED (VERSION 2.4)
PROJECT (FKLAB)

MESSAGE (STATUS "Project: ${PROJECT_NAME}")
EXEC_PROGRAM(gcc ARGS "-dumpversion | grep -o \"^[0-9]\\.[0-9]\"" OUTPUT_VARIABLE GCC_VERSION)
MESSAGE(STATUS "GCC version: ${GCC_VERSION}")
EXEC_PROGRAM(slice2cpp ARGS "--version | grep -o \"^[0-9]\\.[0-9]\"" OUTPUT_VARIABLE ICE_VERSION)
MESSAGE(STATUS "Ice version: ${ICE_VERSION}")

SET (CMAKE_CXX_FLAGS_DEBUG "-g")
SET (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG ")
SET (CMAKE_BUILD_TYPE DEBUG)
#MESSAGE (STATUS ${CMAKE_CXX_FLAGS_DEBUG})
#MESSAGE (STATUS ${CMAKE_CXX_FLAGS_RELEASE})
#MESSAGE (STATUS ${CMAKE_BUILD_TYPE})
#ENABLE_TESTING () 
#ADD_DEFINITIONS ()

SET (FKLAB_ROOT ${CMAKE_SOURCE_DIR}/..)
SET (THIRDPARTY_ROOT ${FKLAB_ROOT}/thirdparty)
SET (ICE_SRC_DIR ${CMAKE_SOURCE_DIR}/test/ice)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/test/ice)
INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}/fklib)
INCLUDE_DIRECTORIES (${THIRDPARTY_ROOT}/include)
LINK_DIRECTORIES (${THIRDPARTY_ROOT}/lib/gcc-${GCC_VERSION})

ADD_CUSTOM_COMMAND (
    OUTPUT ${ICE_SRC_DIR}/Transfer.cpp ${ICE_SRC_DIR}/Transfer.h
    COMMAND slice2cpp ${ICE_SRC_DIR}/Transfer.ice --output-dir ${ICE_SRC_DIR}
    DEPENDS ${ICE_SRC_DIR}/Transfer.ice)
ADD_LIBRARY (fk_ice ${ICE_SRC_DIR}/Transfer.cpp)

ADD_SUBDIRECTORY (test)
ADD_SUBDIRECTORY (bdb)



